from rest_framework import serializers
class NoticeSerializer(serializers.Serializer):
    id = serializers.SerializerMethodField()
    title = serializers.SerializerMethodField()
    content = serializers.SerializerMethodField()
    create_time = serializers.SerializerMethodField()
    creater = serializers.SerializerMethodField()
    def get_id(self, obj):
        return obj.id

    def get_title(self, obj):
        return obj.notice.title

    def get_content(self, obj):
        return obj.notice.content

    def get_create_time(self, obj):
        return obj.notice.create_time

    def get_creater(self,obj):
        return obj.notice.creater.first_name